home *** CD-ROM | disk | FTP | other *** search
/ Aminet 2 / Aminet AMIGA CDROM (1994)(Walnut Creek)[Feb 1994][W.O. 44790-1].iso / Aminet / text / dtp / loutBin203.lha / lout / include / dl < prev    next >
Text File  |  1993-07-14  |  71KB  |  2,125 lines

  1.  
  2. ###############################################################################
  3. #                                                                             #
  4. #  Lout @DocumentLayout package (Version 2.0)                                 #
  5. #                                                                             #
  6. #  Version 1.0 by Jeffrey H. Kingston, 17 July 1991.                          #
  7. #  Version 2.0 by Jeffrey H. Kingston, 22 December 1992.                      #
  8. #                                                                             #
  9. #  This Lout package contains the basic definitions for documents, such as    #
  10. #  simple documents, technical reports, and books.  See "A Beginners' Guide   #
  11. #  to Lout" for user information.                                             #
  12. #                                                                             #
  13. #  Modified by Jeffrey H. Kingston, 22 June 1993, to (a) add an option to     #
  14. #  turn off running titles; (b) fix a bug which was allowing an odd number    #
  15. #  of introductory pages to be generated; (c) bring English-language          #
  16. #  specific parts to the surface so that they can be changed easily; (d)      #
  17. #  fix a bug with @BeginFigures and @BeginTables.                             #
  18. #                                                                             #
  19. ###############################################################################
  20.  
  21. export
  22.     @InitialFont @InitialBreak @Hyphenate
  23.     @MajorHeadingFont @HeadingFont @MinorHeadingFont @ParaGap @ParaIndent
  24.     @DispGap @DispIndent @DefaultIndent @WideIndent @VeryWideIndent
  25.  
  26.     @Roman @UCRoman @Alpha @UCAlpha @Months @ShortMonths
  27.     @WeekDays @ShortWeekDays
  28.  
  29.     "--" "---" @Bullet @ParSym @SectSym @Dagger @DaggerDbl @CDot @Sterling
  30.     @Yen @Florin @Star @Degree @Minute @Second @Multiply @Divide @Lozenge
  31.     @Register @CopyRight @TradeMark
  32.  
  33.     @R @I @B @S @MajorHeading @Heading @MinorHeading "^" "&-" @Date
  34.  
  35.     associate associates declination obligatory philanthropic present presents
  36.     project projects reciprocity recognizance reformation retribution table
  37.  
  38.     @Runner @PageMark @PageOf @NumberOf
  39.  
  40.     @PP @LP @DP @NP @CNP
  41.     
  42.     @BAD     @BeginAlignedDisplays
  43.     @EAD     @EndAlignedDisplays
  44.     @BND     @BeginNumberedDisplays
  45.     @END     @EndNumberedDisplays
  46.  
  47.     @D       @Display
  48.     @LD      @LeftDisplay
  49.     @ID      @IndentedDisplay
  50.     @CD      @CentredDisplay @CenteredDisplay
  51.     @AD      @AlignedDisplay
  52.     @LAD     @LeftAlignedDisplay
  53.     @IAD     @IndentedAlignedDisplay
  54.     @CAD     @CentredAlignedDisplay @CenteredAlignedDisplay
  55.     @ND      @NumberedDisplay
  56.     @LND     @LeftNumberedDisplay
  57.     @IND     @IndentedNumberedDisplay
  58.     @CND     @CentredNumberedDisplay @CenteredNumberedDisplay
  59.     @AND     @AlignedNumberedDisplay
  60.     @LAND    @LeftAlignedNumberedDisplay
  61.     @IAND    @IndentedAlignedNumberedDisplay
  62.     @CAND    @CentredAlignedNumberedDisplay @CenteredAlignedNumberedDisplay
  63.  
  64.     @RD      @RawDisplay
  65.     @RLD     @RawLeftDisplay
  66.     @RID     @RawIndentedDisplay
  67.     @RCD     @RawCentredDisplay @RawCenteredDisplay
  68.     @RAD     @RawAlignedDisplay
  69.     @RLAD    @RawLeftAlignedDisplay
  70.     @RIAD    @RawIndentedAlignedDisplay
  71.     @RCAD    @RawCentredAlignedDisplay @RawCenteredAlignedDisplay
  72.     @RND     @RawNumberedDisplay
  73.     @RLND    @RawLeftNumberedDisplay
  74.     @RIND    @RawIndentedNumberedDisplay
  75.     @RCND    @RawCentredNumberedDisplay @RawCenteredNumberedDisplay
  76.     @RAND    @RawAlignedNumberedDisplay
  77.     @RLAND   @RawLeftAlignedNumberedDisplay
  78.     @RIAND   @RawIndentedAlignedNumberedDisplay
  79.     @RCAND   @RawCentredAlignedNumberedDisplay
  80.              @RawCenteredAlignedNumberedDisplay
  81.     
  82.     @LI      @ListItem
  83.     @EL      @EndList
  84.  
  85.     @RLL     @RawLeftList
  86.     @RCL     @RawCentredList @RawCenteredList
  87.  
  88.     @LL         @LeftList
  89.     @CL         @CentredList @CenteredList
  90.  
  91.     @RIL     @RawIndentedList
  92.     @RNL     @RawNumberedList
  93.     @RPNL    @RawParenNumberedList
  94.     @RRL     @RawRomanList
  95.     @RPRL    @RawParenRomanList
  96.     @RUCRL   @RawUCRomanList
  97.     @RPUCRL  @RawParenUCRomanList
  98.     @RAL     @RawAlphaList
  99.     @RPAL    @RawParenAlphaList
  100.     @RUCAL   @RawUCAlphaList
  101.     @RPUCAL  @RawParenUCAlphaList
  102.     @RBL     @RawBulletList
  103.     @RSL     @RawStarList
  104.     @RDL     @RawDashList
  105.  
  106.     @IL      @IndentedList
  107.     @NL      @NumberedList 
  108.     @PNL     @ParenNumberedList
  109.     @RL      @RomanList
  110.     @PRL     @ParenRomanList
  111.     @UCRL    @UCRomanList
  112.     @PUCRL   @ParenUCRomanList
  113.     @AL      @AlphaList
  114.     @PAL     @ParenAlphaList
  115.     @UCAL    @UCAlphaList
  116.     @PUCAL   @ParenUCAlphaList
  117.     @BL      @BulletList 
  118.     @SL      @StarList 
  119.     @DL      @DashList
  120.  
  121.     @TI      @TagItem
  122.     @RTL     @RawTaggedList
  123.     @RWTL    @RawWideTaggedList
  124.     @RVWTL   @RawVeryWideTaggedList
  125.  
  126.     @TL         @TaggedList
  127.     @WTL     @WideTaggedList
  128.     @VWTL    @VeryWideTaggedList
  129.  
  130.     @Document @Doc @Report @Book            # root galley objects
  131.     @Abstract @Preface @Introduction            # outer level galleys
  132.     @Chapter @Section @Appendix @Text @ColText
  133.     @Figure @EndFigures @Table @EndTables        # inner level galleys
  134.     @Reference @RefStyle @RefPrint
  135.     @ReferenceSection @Ref @ChapRefSection @ChapRef
  136.     @IndexSection @Index @SubIndex @SubSubIndex @RawIndex
  137.     @RawSubIndex @RawSubSubIndex @IndexBlanks
  138.     @ContentsSection
  139.  
  140.  
  141.  
  142. def @DocumentLayout
  143.     named @InitialFont       {  Times Base 12p } # initial font
  144.     named @InitialBreak      {  adjust 1.20fx  } # initial break
  145.     named @Hyphenate         {  Yes            } # Want hyphenation? Yes or No
  146.     named @MajorHeadingFont  {  Bold 2.0f      } # font for major headings
  147.     named @HeadingFont       {  Bold           } # font for ordinary headings
  148.     named @MinorHeadingFont  {  Bold           } # font for minor headings
  149.     named @BookCoverFont     {  Helvetica Base } # font for book cover
  150.  
  151.     named @ParaGap           {  1.30vx         } # gap between paragraphs
  152.     named @ParaIndent        {  2.00f          } # paragraph first-line indent
  153.  
  154.     named @DispGap           {  1.00v          } # gap above and below displays
  155.     named @DispIndent        {  2.00f          } # @IndentedDisplay indent
  156.     named @DefaultIndent     {  0.5rt          } # @Display indent
  157.     named @WideIndent        {  4.00f          } # @WideTaggedList indent
  158.     named @VeryWideIndent    {  8.00f          } # @VeryWideTaggedList indent
  159.  
  160.     named @PageWidth         { 8.50i          } # width of page
  161.     named @PageHeight        { 11.0i          } # height of page
  162.     named @PageMargin        {  2.50c          } # size of all four margins
  163.     named @Columns           {  Single         } # Single, Double, Multi
  164.     named @DoubleColWidth    {  7.50c          } # column width used by Double
  165.     named @MultiColWidth     {  4.67c          } # column width used by Multi
  166.     named @ColGap            {  1.00c          } # gap between columns
  167.     named @TopGap            {  0.75c          } # gap between figures
  168.     named @MidGap            {  0.75c          } # gap above and below body text
  169.  
  170.     named @FootNoteFont      {  0.80f          } # font for footnotes
  171.     named @FootNoteBreak     {  1.20fx         } # break for footnotes
  172.     named @FootLen           {  2.00c          } # footnote line and indent size
  173.     named @ColFootLen        {  1.20c          } # @FootLen when Double, Multi
  174.     named @FootGap           {  0.20c          } # gap between footnotes
  175.  
  176.     named @MakeIndex         {  No             } # Want index? Yes or No
  177.     named @IndexColumns      {  Double         } # Single, Double, Multi
  178.  
  179.     named @TableOfContents   {  No             } # Want contents? Yes or No
  180.     named @MajorContentsGap  {  1.30v          } # gap above major entry
  181.     named @ContentsGap       {  1.00v          } # gap above ordinary entry
  182.  
  183.     named @ChapterNumbers    {  Yes            } # Yes or No            
  184.     named @SectionNumbers    {  Yes            } # Yes or No            
  185.     named @SubSectionNumbers {  Yes            } # Yes or No            
  186.     named @AppendixNumbers   {  Yes            } # Yes or No            
  187.     named @SubAppendixNumbers{  Yes            } # Yes or No            
  188.     named @ChapterGap        {  1.10b          } # gap before each chapter
  189.     named @SectionGap        {  2.00v          } # gap before each section
  190.     named @SubSectionGap     {  1.50v          } # gap before each subsection
  191.     named @AppendixGap       {  2.00v          } # gap before each appendix
  192.     named @SubAppendixGap    {  2.00v          } # gap before each subappendix
  193.  
  194.     named @PageNumbers       {  Yes            } # Want page numbers? Yes or No
  195.     named @FirstPageNumber   {  1              } # Number of first page 
  196.     named @RunningTitles     {  Yes            } # Want running titles? Yes/No
  197.     named @PageOneTopFormat  right @PageNum { @Null               }
  198.     named @PageOneFootFormat right @PageNum { @Null               }
  199.     named @PageTopFormat     right @PageNum { |0.5rt - @PageNum - }
  200.     named @PageFootFormat    right @PageNum { @Null               }
  201.     named @BookTitleFormat   right @Title   { Bold @Font @Title   } 
  202.  
  203. @Begin
  204.  
  205.     ###########################################################################
  206.     #                                                                         #
  207.     #  Complete list of English-language-specific output in this package.     #
  208.     #  To translate to another language, change these but also change the     #
  209.     #  "standard" database in $(LIBDIR)/data/standard.ld (don't forget to     #
  210.     #  delete standard.li if you change standard.ld).                         #
  211.     #                                                                         #
  212.     ###########################################################################
  213.  
  214.     def @ContentsWord        { Contents    }
  215.     def @ReferencesWord        { References    }
  216.     def @FigureWord        { Figure    }
  217.     def @TableWord        { Table        }
  218.     def @AbstractWord        { ABSTRACT    }
  219.     def @PrefaceWord        { Preface    }
  220.     def @IntroductionWord    { Introduction    }
  221.     def @ChapterWord        { Chapter    }
  222.     def @AppendixWord        { Appendix    }
  223.     def @IndexWord        { Index        }
  224.  
  225.  
  226.     ###########################################################################
  227.     #                                                                         #
  228.     #  @Protect x                                                             #
  229.     #                                                                         #
  230.     #  Like @CNP, this reserves space on the current page or else makes sure  #
  231.     #  x appears on the following page.  Lookahead is proportional to font    #
  232.     #  size.                                                                  #
  233.     #                                                                         #
  234.     ###########################################################################
  235.  
  236.     def @Protect right x { 3.0f @High //0io // x }
  237.  
  238.  
  239.     ###########################################################################
  240.     #                                                                         #
  241.     #   @HLine                                                                #
  242.     #                                                                         #
  243.     #   Draws a horizontal line to fill available space.                      #
  244.     #                                                                         #
  245.     ###########################################################################
  246.  
  247.     def @HLine { {0 0 moveto xsize 0 lineto stroke} @Graphic {} }
  248.  
  249.  
  250.     ###########################################################################
  251.     #                                                                         #
  252.     #  Symbols stored in the "standard" database:                             #
  253.     #                                                                         #
  254.     #    @Roman           lower case Roman numerals i, ii, ... , c            #
  255.     #    @UCRoman         upper case Roman numerals I, II, ... , C            #
  256.     #    @Alpha           lower case Roman alphabet a, b,  ... , z            #
  257.     #    @UCAlpha         upper case Roman alphabet A, B,  ... , Z            #
  258.     #    @Months          months of the year:  January, ... , December        #
  259.     #    @ShortMonths     months of the year, abbreviated:  Jan, ... , Dec    #
  260.     #    @WeekDays        days of the week:  Sunday, ... , Saturday           #
  261.     #    @ShortWeekDays   days of the week, abbreviated:  Sun, ... , Sat      #
  262.     #                                                                         #
  263.     ###########################################################################
  264.  
  265.     def @Roman        left @Tag right @Val { @Val }
  266.     def @UCRoman    left @Tag right @Val { @Val }
  267.     def @Alpha        left @Tag right @Val { @Val }
  268.     def @UCAlpha    left @Tag right @Val { @Val }
  269.     def @Months        left @Tag right @Val { @Val }
  270.     def @ShortMonths    left @Tag right @Val { @Val }
  271.     def @WeekDays    left @Tag right @Val { @Val }
  272.     def @ShortWeekDays    left @Tag right @Val { @Val }
  273.  
  274.     @SysDatabase @Roman @UCRoman @Alpha @UCAlpha @Months
  275.          @ShortMonths @WeekDays @ShortWeekDays
  276.     { standard  }
  277.  
  278.  
  279.     ###########################################################################
  280.     #                                                                         #
  281.     #  Selected characters from Adobe's fonts.                                #
  282.     #                                                                         #
  283.     ###########################################################################
  284.  
  285.     def "--"        { @Char "endash"                 }
  286.     def "---"        { @Char "emdash"                 }
  287.     def @Bullet        { @Char "bullet"                }
  288.     def @ParSym        { @Char "paragraph"                }
  289.     def @SectSym    { @Char "section"                }
  290.     def @Dagger        { @Char "dagger"                }
  291.     def @DaggerDbl    { @Char "daggerdbl"                }
  292.     def @CDot        { @Char "periodcentered"            }
  293.     def @Sterling    { @Char "sterling"                }
  294.     def @Yen        { @Char "yen"                    }
  295.     def @Florin        { @Char "florin"                }
  296.     def @Star        { { Symbol Base } @Font @Char "asteriskmath"    }
  297.     def @Degree        { { Symbol Base } @Font @Char "degree"        }
  298.     def @Minute        { { Symbol Base } @Font @Char "minute"        }
  299.     def @Second        { { Symbol Base } @Font @Char "second"        }
  300.     def @Multiply    { { Symbol Base } @Font @Char "multiply"    }
  301.     def @Divide        { { Symbol Base } @Font @Char "divide"        }
  302.     def @Lozenge    { { Symbol Base } @Font @Char "lozenge"        }
  303.     def @Register    { { Symbol Base } @Font @Char "registersans"    }
  304.     def @CopyRight    { { Symbol Base } @Font @Char "copyrightsans"    }
  305.     def @TradeMark    { { Symbol Base } @Font @Char "trademarksans"    }
  306.  
  307.  
  308.     ###########################################################################
  309.     #                                                                         #
  310.     #  Miscellaneous.                                                         #
  311.     #                                                                         #
  312.     ###########################################################################
  313.  
  314.     def @R             right x { Base @Font x                 }
  315.     def @I             right x { Slope @Font x                 }
  316.     def @B             right x { Bold @Font x                 }
  317.     def @S             right x { @OneRow { //0.04fo 0.8f @Font x }     }
  318.     def "^"               { {} ^& {}                 }
  319.     def "&-"  left x   right y { x &0ch y                 }
  320.     def @MajorHeading  right x { ragged @Break @MajorHeadingFont @Font x }
  321.     def @Heading       right x { ragged @Break @HeadingFont      @Font x }
  322.     def @MinorHeading  right x { ragged @Break @MinorHeadingFont @Font x }
  323.     def @Date { @Moment&&now @Open {@Day {@Months&&@Month}, @Century{@Year}} }
  324.  
  325.  
  326.     ###########################################################################
  327.     #                                                                         #
  328.     #  Exception list for hyphenation.                                        #
  329.     #                                                                         #
  330.     ###########################################################################
  331.  
  332.     def associate     { "as" &- "so" &- "ciate"                }
  333.     def associates    { "as" &- "so" &- "ciates"            }
  334.     def declination   { "dec" &- "li" &- "na" &- "tion"            }
  335.     def obligatory    { "oblig" &- "a" &- "tory"            }
  336.     def philanthropic { "phil" &- "an" &- "thropic"            }
  337.     def present       { "present"                    }
  338.     def presents      { "presents"                    }
  339.     def project       { "project"                    }
  340.     def projects      { "projects"                    }
  341.     def reciprocity   { "reci" &- "procity"                }
  342.     def recognizance  { "re" &- "cog" &- "ni" &- "zance"        }
  343.     def reformation   { "ref" &- "or" &- "ma" &- "tion"            }
  344.     def retribution   { "ret" &- "ri" &- "bu" &- "tion"            }
  345.     def table         { "ta" &- "ble"                    }
  346.  
  347.     def Associate     { "As" &- "so" &- "ciate"                }
  348.     def Associates    { "As" &- "so" &- "ciates"            }
  349.     def Declination   { "Dec" &- "li" &- "na" &- "tion"            }
  350.     def Obligatory    { "Oblig" &- "a" &- "tory"            }
  351.     def Philanthropic { "Phil" &- "an" &- "thropic"            }
  352.     def Present       { "Present"                    }
  353.     def Presents      { "Presents"                    }
  354.     def Project       { "Project"                    }
  355.     def Projects      { "Projects"                    }
  356.     def Reciprocity   { "Reci" &- "procity"                }
  357.     def Recognizance  { "Re" &- "cog" &- "ni" &- "zance"        }
  358.     def Reformation   { "Ref" &- "or" &- "ma" &- "tion"            }
  359.     def Retribution   { "Ret" &- "ri" &- "bu" &- "tion"            }
  360.     def Table         { "Ta" &- "ble"                    }
  361.  
  362.  
  363.     ###########################################################################
  364.     #                                                                         #
  365.     #  Page and item markers.   @Runner is used only by books.                #
  366.     #                                                                         #
  367.     ###########################################################################
  368.  
  369.     export @Tag
  370.     def @PageMarker
  371.     right @Tag
  372.     {
  373.     @Null
  374.     }
  375.  
  376.     def @PageMark
  377.     right x
  378.     {
  379.     @PageMarker&&preceding @Tagged x
  380.     }
  381.  
  382.     def @PageOf
  383.     right x
  384.     {
  385.     @PageMarker&&x @Open { @Tag }
  386.     }
  387.  
  388.     export @Tag
  389.     def @NumberMarker
  390.     right @Tag
  391.     {
  392.     @Null
  393.     }
  394.  
  395.     def @NumberOf
  396.     right x
  397.     {
  398.     @NumberMarker&&x @Open { @Tag }
  399.     }
  400.  
  401.     export @TopOdd @TopEven @FootOdd @FootEven
  402.     def @Runner
  403.     named @TopOdd    right @PageNum { @Null }
  404.     named @TopEven    right @PageNum { @Null }
  405.     named @FootOdd    right @PageNum { @Null }
  406.     named @FootEven    right @PageNum { @Null }
  407.     named @Tag {}
  408.     { @Null
  409.     }
  410.  
  411.  
  412.     ###########################################################################
  413.     #                                                                         #
  414.     #   @Hyph x                                                               #
  415.     #                                                                         #
  416.     #   Return "hyphen" if x is "Yes" or "yes", else "nohyphen".              #
  417.     #                                                                         #
  418.     ###########################################################################
  419.  
  420.     def @Hyph right x
  421.     {
  422.     x @Case {
  423.         {Yes yes} @Yield "hyphen"
  424.         else      @Yield "nohyphen"
  425.     }
  426.     }
  427.  
  428.  
  429.     ###########################################################################
  430.     #                                                                         #
  431.     #  x @OrElse y                                                            #
  432.     #                                                                         #
  433.     #  This returns x unless its value is "dft", in which case it returns y.  #
  434.     #  Useful for defaulting the value of one parameter to another.           #
  435.     #                                                                         #
  436.     ###########################################################################
  437.  
  438.     def @OrElse
  439.     left x
  440.     right y
  441.     {
  442.     x @Case {
  443.         dft  @Yield y
  444.         else @Yield x
  445.     }
  446.     }
  447.  
  448.  
  449.     ###########################################################################
  450.     #                                                                         #
  451.     #  Paragraphs.                                                            #
  452.     #                                                                         #
  453.     ###########################################################################
  454.  
  455.     macro @PP    { //@ParaGap @ParaIndent @Wide &0i }
  456.     macro @LP    { //@ParaGap               }
  457.     macro @DP    { //@DispGap               }
  458.     macro @NP    { //1.1b               }
  459.     macro @CNP    { // 3.2v @High //0io //           }
  460.  
  461.  
  462.     ###########################################################################
  463.     #                                                                         #
  464.     #  Beginning and ending of aligned displays.                              #
  465.     #                                                                         #
  466.     ###########################################################################
  467.  
  468.     def @APlace            { @Galley }
  469.     def @EndAlignedPlace   { @Galley }
  470.     def @AlignedPlace      { @Galley }
  471.  
  472.     def @BAligned into { @APlace&&preceding }
  473.     {
  474.     def @AlignedList { @AlignedPlace /1.1b @AlignedList }
  475.  
  476.     //1.1b @AlignedList
  477.     //     @EndAlignedPlace
  478.     }
  479.  
  480.     macro @BAD { // @APlace | @BAligned }
  481.     def   @EAD force into { @EndAlignedPlace&&preceding } {}
  482.  
  483.     macro @BeginAlignedDisplays { @BAD }
  484.     macro @EndAlignedDisplays   { @EAD }
  485.  
  486.  
  487.     ###########################################################################
  488.     #                                                                         #
  489.     #  Beginning and ending of numbered displays.                             #
  490.     #                                                                         #
  491.     ###########################################################################
  492.  
  493.     def @BeginNumberedPlace { @Galley }
  494.     def @EndNumberedPlace   { @Galley }
  495.     def @NextNumberPlace    { @Galley }
  496.  
  497.     def @NNumber into { @NextNumberPlace&&following } {}
  498.     macro @NN { @NNumber @BeginNumberedPlace }
  499.  
  500.     def @BNumbered into { @BeginNumberedPlace&&preceding }
  501.     named style right tag { (tag) }
  502.     named start { 1 }
  503.     {
  504.     def @NList right num
  505.     {
  506.         |1rt style num & @NumberMarker num & @NextNumberPlace
  507.         // @NList @Next num
  508.     }
  509.  
  510.     //  @NList start
  511.     //  @EndNumberedPlace
  512.     }
  513.  
  514.     macro @BND { // @BeginNumberedPlace // @BNumbered }
  515.     def   @END force into { @EndNumberedPlace&&preceding } {}
  516.     
  517.     macro @BeginNumberedDisplays { @BND }
  518.     macro @EndNumberedDisplays   { @END }
  519.  
  520.  
  521.     ###########################################################################
  522.     #                                                                         #
  523.     #  Galleys which carry displays to their places.                          #
  524.     #                                                                         #
  525.     ###########################################################################
  526.  
  527.     def @DispPlace { @Galley }
  528.  
  529.     def @Disp into { @DispPlace&&preceding }
  530.     right x
  531.     {
  532.     @OneRow x
  533.     }
  534.  
  535.     def @NDisp into { @DispPlace&&preceding }
  536.     named @Tag {}
  537.     right x
  538.     {
  539.     @OneRow {
  540.        @NumberMarker&&following @Tagged @Tag
  541.        @PageMarker&&preceding @Tagged @Tag
  542.        ^//
  543.        @OneRow x
  544.     }
  545.     }
  546.  
  547.     def @ADisp into { @AlignedPlace&&preceding }
  548.     right x
  549.     {
  550.     @OneRow x
  551.     }
  552.  
  553.     def @ANDisp into { @AlignedPlace&&preceding }
  554.     named @Tag {}
  555.     right x
  556.     {
  557.     @OneRow {
  558.        @NumberMarker&&following @Tagged @Tag
  559.        @PageMarker&&preceding @Tagged @Tag
  560.        ^/
  561.        @OneRow x
  562.     }
  563.     }
  564.  
  565.  
  566.     ###########################################################################
  567.     #                                                                         #
  568.     #  Displays and raw displays.                                             #
  569.     #                                                                         #
  570.     ###########################################################################
  571.  
  572.     macro @G  { |@DefaultIndent }
  573.     macro @LG { |               }
  574.     macro @IG { |@DispIndent    }
  575.     macro @CG { |0.5rt          }
  576.  
  577.     macro @D     { @DP @G   @DispPlace  |        @DP // @Disp   }
  578.     macro @LD    { @DP @LG  @DispPlace  |        @DP // @Disp   }
  579.     macro @ID    { @DP @IG  @DispPlace  |        @DP // @Disp   }
  580.     macro @CD    { @DP @CG  @DispPlace  |        @DP // @Disp   }
  581.  
  582.     macro @AD    { @DP @G   @APlace     |        @DP // @ADisp  }
  583.     macro @LAD   { @DP @LG  @APlace     |        @DP // @ADisp  }
  584.     macro @IAD   { @DP @IG  @APlace     |        @DP // @ADisp  }
  585.     macro @CAD   { @DP @CG  @APlace     |        @DP // @ADisp  }
  586.  
  587.     macro @ND    { @DP @G   @DispPlace  |1rt @NN @DP // @NDisp  }
  588.     macro @LND   { @DP @LG  @DispPlace  |1rt @NN @DP // @NDisp  }
  589.     macro @IND   { @DP @IG  @DispPlace  |1rt @NN @DP // @NDisp  }
  590.     macro @CND   { @DP @CG  @DispPlace  |1rt @NN @DP // @NDisp  }
  591.  
  592.     macro @AND   { @DP @G   @APlace     |1rt @NN @DP // @ANDisp }
  593.     macro @LAND  { @DP @LG  @APlace     |1rt @NN @DP // @ANDisp }
  594.     macro @IAND  { @DP @IG  @APlace     |1rt @NN @DP // @ANDisp }
  595.     macro @CAND  { @DP @CG  @APlace     |1rt @NN @DP // @ANDisp }
  596.  
  597.  
  598.     macro @RD    {     @G   @DispPlace  |               @Disp   }
  599.     macro @RLD   {     @LG  @DispPlace  |               @Disp   }
  600.     macro @RID   {     @IG  @DispPlace  |               @Disp   }
  601.     macro @RCD   {     @CG  @DispPlace  |               @Disp   }
  602.  
  603.     macro @RAD   {     @G   @APlace     |               @ADisp  }
  604.     macro @RLAD  {     @LG  @APlace     |               @ADisp  }
  605.     macro @RIAD  {     @IG  @APlace     |               @ADisp  }
  606.     macro @RCAD  {     @CG  @APlace     |               @ADisp  }
  607.  
  608.     macro @RND   {     @G   @DispPlace  |1rt @NN        @NDisp  }
  609.     macro @RLND  {     @LG  @DispPlace  |1rt @NN        @NDisp  }
  610.     macro @RIND  {     @IG  @DispPlace  |1rt @NN        @NDisp  }
  611.     macro @RCND  {     @CG  @DispPlace  |1rt @NN        @NDisp  }
  612.  
  613.     macro @RAND  {     @G   @APlace     |1rt @NN        @ANDisp }
  614.     macro @RLAND {     @LG  @APlace     |1rt @NN        @ANDisp }
  615.     macro @RIAND {     @IG  @APlace     |1rt @NN        @ANDisp }
  616.     macro @RCAND {     @CG  @APlace     |1rt @NN        @ANDisp }
  617.  
  618.  
  619.     macro @Display                            { @D     }
  620.     macro @LeftDisplay                        { @LD    }
  621.     macro @IndentedDisplay                    { @ID    }
  622.     macro @CentredDisplay                     { @CD    }
  623.     macro @CenteredDisplay                    { @CD    }
  624.  
  625.     macro @AlignedDisplay                     { @AD    }
  626.     macro @LeftAlignedDisplay                 { @LAD   }
  627.     macro @IndentedAlignedDisplay             { @IAD   }
  628.     macro @CentredAlignedDisplay              { @CAD   }
  629.     macro @CenteredAlignedDisplay             { @CAD   }
  630.  
  631.     macro @NumberedDisplay                    { @ND    }
  632.     macro @LeftNumberedDisplay                { @LND   }
  633.     macro @IndentedNumberedDisplay            { @IND   }
  634.     macro @CentredNumberedDisplay             { @CND   }
  635.     macro @CenteredNumberedDisplay            { @CND   }
  636.  
  637.     macro @AlignedNumberedDisplay             { @AND   }
  638.     macro @LeftAlignedNumberedDisplay         { @LAND  }
  639.     macro @IndentedAlignedNumberedDisplay     { @IAND  }
  640.     macro @CentredAlignedNumberedDisplay      { @CAND  }
  641.     macro @CenteredAlignedNumberedDisplay     { @CAND  }
  642.  
  643.  
  644.     macro @RawDisplay                         { @RD    }
  645.     macro @RawLeftDisplay                     { @RLD   }
  646.     macro @RawIndentedDisplay                 { @RID   }
  647.     macro @RawCentredDisplay                  { @RCD   }
  648.     macro @RawCenteredDisplay                 { @RCD   }
  649.  
  650.     macro @RawAlignedDisplay                  { @RAD   }
  651.     macro @RawLeftAlignedDisplay              { @RLAD  }
  652.     macro @RawIndentedAlignedDisplay          { @RIAD  }
  653.     macro @RawCentredAlignedDisplay           { @RCAD  }
  654.     macro @RawCenteredAlignedDisplay          { @RCAD  }
  655.  
  656.     macro @RawNumberedDisplay                 { @RND   }
  657.     macro @RawLeftNumberedDisplay             { @RLND  }
  658.     macro @RawIndentedNumberedDisplay         { @RIND  }
  659.     macro @RawCentredNumberedDisplay          { @RCND  }
  660.     macro @RawCenteredNumberedDisplay         { @RCND  }
  661.  
  662.     macro @RawAlignedNumberedDisplay          { @RAND  }
  663.     macro @RawLeftAlignedNumberedDisplay      { @RLAND }
  664.     macro @RawIndentedAlignedNumberedDisplay  { @RIAND }
  665.     macro @RawCentredAlignedNumberedDisplay   { @RCAND }
  666.     macro @RawCenteredAlignedNumberedDisplay  { @RCAND }
  667.  
  668.  
  669.     ###########################################################################
  670.     #                                                                         #
  671.     #  Lists and raw lists (except indented lists).                           #
  672.     #                                                                         #
  673.     ###########################################################################
  674.  
  675.     def   @ItemPlace { @Galley }
  676.     def   @ListItem into { @ItemPlace&&preceding } right x { x }
  677.     macro @LI { @ListItem }
  678.  
  679.     def   @EndListPlace { @Galley }
  680.     def   @EndList force into { @EndListPlace&&preceding } {}
  681.     macro @EL { @EndList }
  682.  
  683.     def @RLL
  684.     named indent { @DispIndent }
  685.     named gap    { @DispGap }
  686.     {
  687.     def @List { |indent @ItemPlace | //gap @List }
  688.  
  689.     @List // @EndListPlace
  690.     }
  691.  
  692.     def   @RCL    { @RLL indent { 0.5rt     } }
  693.     macro @LL    { @DP @RLL @DP    }
  694.     macro @CL    { @DP @RCL @DP    }
  695.  
  696.     macro @RawLeftList        { @RLL    }
  697.     macro @RawCentredList    { @RCL    }
  698.     macro @RawCenteredList    { @RCL    }
  699.     macro @LeftList        { @LL    }
  700.     macro @CentredList        { @CL    }
  701.     macro @CenteredList        { @CL    }
  702.  
  703.  
  704.     ###########################################################################
  705.     #                                                                         #
  706.     #  Indented lists and raw indented lists, tagged automatically.           #
  707.     #                                                                         #
  708.     ###########################################################################
  709.  
  710.     def @RawIndentedList
  711.        named style right tag    {               }
  712.        named indent        { @DispIndent    }
  713.        named gap        { @DispGap    }
  714.        named start        { 1        }
  715.     {
  716.     def @IList right num
  717.     {   indent @Wide {style num} | @ItemPlace |
  718.         //gap @IList @Next num
  719.     }
  720.  
  721.     @IList start // @EndListPlace
  722.     }
  723.  
  724.     def @RawNumberedList      { @RawIndentedList style { tag.               } }
  725.     def @RawParenNumberedList { @RawIndentedList style { (tag)               } }
  726.     def @RawRomanList          { @RawIndentedList style { {@Roman&&tag}.    } }
  727.     def @RawParenRomanList    { @RawIndentedList style { ({@Roman&&tag})   } }
  728.     def @RawUCRomanList          { @RawIndentedList style { {@UCRoman&&tag}.  } }
  729.     def @RawParenUCRomanList  { @RawIndentedList style { ({@UCRoman&&tag}) } }
  730.     def @RawAlphaList          { @RawIndentedList style { {@Alpha&&tag}.    } }
  731.     def @RawParenAlphaList    { @RawIndentedList style { ({@Alpha&&tag})   } }
  732.     def @RawUCAlphaList          { @RawIndentedList style { {@UCAlpha&&tag}.  } }
  733.     def @RawParenUCAlphaList  { @RawIndentedList style { ({@UCAlpha&&tag}) } }
  734.     def @RawBulletList          { @RawIndentedList style { @Bullet       } }
  735.     def @RawStarList          { @RawIndentedList style { @Star           } }
  736.     def @RawDashList          { @RawIndentedList style { --            } }
  737.  
  738.     macro @IndentedList          { @DP @RawIndentedList        @DP }
  739.     macro @NumberedList          { @DP @RawNumberedList        @DP }
  740.     macro @ParenNumberedList  { @DP @RawParenNumberedList    @DP }
  741.     macro @RomanList          { @DP @RawRomanList        @DP }
  742.     macro @ParenRomanList     { @DP @RawParenRomanList        @DP }
  743.     macro @UCRomanList          { @DP @RawUCRomanList        @DP }
  744.     macro @ParenUCRomanList   { @DP @RawParenUCRomanList    @DP }
  745.     macro @AlphaList          { @DP @RawAlphaList        @DP }
  746.     macro @ParenAlphaList     { @DP @RawParenAlphaList        @DP }
  747.     macro @UCAlphaList          { @DP @RawUCAlphaList        @DP }
  748.     macro @ParenUCAlphaList   { @DP @RawParenUCAlphaList    @DP }
  749.     macro @BulletList          { @DP @RawBulletList        @DP }
  750.     macro @StarList          { @DP @RawStarList        @DP }
  751.     macro @DashList          { @DP @RawDashList        @DP }
  752.  
  753.     macro @RIL        { @RawIndentedList    }
  754.     macro @RNL        { @RawNumberedList    }
  755.     macro @RPNL        { @RawParenNumberedList    }
  756.     macro @RRL        { @RawRomanList        }
  757.     macro @RPRL        { @RawParenRomanList    }
  758.     macro @RUCRL    { @RawUCRomanList    }
  759.     macro @RPUCRL    { @RawParenUCRomanList    }
  760.     macro @RAL        { @RawAlphaList        }
  761.     macro @RPAL        { @RawParenAlphaList    }
  762.     macro @RUCAL    { @RawUCAlphaList    }
  763.     macro @RPUCAL    { @RawParenUCAlphaList    }
  764.     macro @RBL        { @RawBulletList    }
  765.     macro @RSL        { @RawStarList        }
  766.     macro @RDL        { @RawDashList        }
  767.  
  768.     macro @IL        { @IndentedList        }
  769.     macro @NL        { @NumberedList        }
  770.     macro @PNL        { @ParenNumberedList    }
  771.     macro @RL        { @RomanList        }
  772.     macro @PRL        { @ParenRomanList    }
  773.     macro @UCRL        { @UCRomanList        }
  774.     macro @PUCRL    { @ParenUCRomanList    }
  775.     macro @AL        { @AlphaList        }
  776.     macro @PAL        { @ParenAlphaList    }
  777.     macro @UCAL        { @UCAlphaList        }
  778.     macro @PUCAL    { @ParenUCAlphaList    }
  779.     macro @BL        { @BulletList        }
  780.     macro @SL        { @StarList        }
  781.     macro @DL        { @DashList        }
  782.  
  783.  
  784.     ###########################################################################
  785.     #                                                                         #
  786.     #  Indented lists and raw indented lists, tagged by the author.           #
  787.     #                                                                         #
  788.     ###########################################################################
  789.  
  790.     def @TagPlace    { @Galley }
  791.  
  792.     def @TagItem into { @ItemPlace&&preceding }
  793.        left x
  794.        right y
  795.     { 
  796.        def senditem into { @TagPlace&&preceding } { x }
  797.  
  798.        senditem | y
  799.     }
  800.  
  801.     macro @TI { @TagItem }
  802.  
  803.     def @RawTaggedList
  804.     named style right tag { tag }
  805.     named indent { @DispIndent }
  806.     named gap    { @DispGap }
  807.     {
  808.     def @LList
  809.     {   indent @Wide {style @TagPlace} | @ItemPlace
  810.         //gap @LList
  811.     }
  812.  
  813.     @LList // @EndListPlace
  814.     }
  815.  
  816.     def @RawWideTaggedList    { @RawTaggedList indent { @WideIndent       } }
  817.     def @RawVeryWideTaggedList    { @RawTaggedList indent { @VeryWideIndent   } }
  818.     macro @TaggedList        { @DP @RawTaggedList        @DP }
  819.     macro @WideTaggedList    { @DP @RawWideTaggedList    @DP }
  820.     macro @VeryWideTaggedList    { @DP @RawVeryWideTaggedList    @DP }
  821.  
  822.     macro @RTL        { @RawTaggedList        }
  823.     macro @RWTL        { @RawWideTaggedList        }
  824.     macro @RVWTL    { @RawVeryWideTaggedList    }
  825.     macro @TL        { @TaggedList            }
  826.     macro @WTL        { @WideTaggedList        }
  827.     macro @VWTL        { @VeryWideTaggedList        }
  828.  
  829.  
  830.  
  831.     ###########################################################################
  832.     #                                                                         #
  833.     #  Definitions for laying out one general-purpose page.                   #
  834.     #                                                                         #
  835.     ###########################################################################
  836.  
  837.     def @FullPlace        { @Galley }
  838.     def @ColPlace         { @Galley }
  839.     def @IndexPlace       { @Galley }
  840.  
  841.     export @Tag
  842.     def @TopList right @Tag
  843.     {
  844.            @Galley
  845.     //@TopGap  @TopList @Next @Tag
  846.     }
  847.  
  848.     export @Tag
  849.     def @FootList right @Tag
  850.     {
  851.             @Galley
  852.     //@FootGap  @FootList @Next @Tag
  853.     }
  854.  
  855.     def @FootSect
  856.     {
  857.             @FootLen @Wide @HLine
  858.     //@FootGap  @FootList 1 ||@FootLen
  859.     }
  860.  
  861.     export @Tag
  862.     def @ColFootList right @Tag
  863.     {
  864.             @Galley
  865.     //@FootGap  @ColFootList @Next @Tag
  866.     }
  867.  
  868.     def @ColFootSect
  869.     {
  870.             @ColFootLen @Wide @HLine
  871.     //@FootGap  @ColFootList 1 ||@ColFootLen
  872.     }
  873.  
  874.     def @ColList right col
  875.     {
  876.     def @Column
  877.     {
  878.         @VExpand { @ColPlace //1rt @OneRow { //@MidGap @ColFootSect } }
  879.     }
  880.  
  881.     col @Case {
  882.  
  883.         Single @Yield @Column
  884.  
  885.         Double @Yield { @DoubleColWidth @Wide @Column
  886.                 ||@ColGap @ColList col }
  887.  
  888.         Multi  @Yield { @MultiColWidth @Wide @Column
  889.                 ||@ColGap @ColList col }
  890.  
  891.     }
  892.     }
  893.     
  894.     def @IndexColList right col
  895.     {
  896.     col @Case {
  897.  
  898.         Single @Yield @VExpand @IndexPlace
  899.  
  900.         Double @Yield { @DoubleColWidth @Wide @VExpand @IndexPlace
  901.                 ||@ColGap @IndexColList col }
  902.  
  903.         Multi  @Yield { @MultiColWidth @Wide @VExpand @IndexPlace
  904.                 ||@ColGap @IndexColList col }
  905.  
  906.     }
  907.     }
  908.  
  909.     def @Page right x
  910.     {    @PageWidth @Wide @PageHeight @High
  911.     {   //@PageMargin ||@PageMargin
  912.         @HExpand @VExpand x
  913.         ||@PageMargin //@PageMargin
  914.     }
  915.     }
  916.  
  917.     def @OnePage
  918.     named @Columns {}
  919.     named @PageTop {}
  920.     named @PageFoot {}
  921.     {
  922.     @Page {
  923.               @PageTop
  924.         //@MidGap @TopList
  925.         //@MidGap @FullPlace
  926.         //@MidGap @ColList @Columns
  927.         //@MidGap @IndexColList @IndexColumns
  928.         // //1rt  @OneRow { //@MidGap @FootSect //@MidGap @PageFoot }
  929.     }
  930.     }
  931.  
  932.  
  933.     ###########################################################################
  934.     #                                                                         #
  935.     #  Definitions for laying out introductory pages.                         #
  936.     #                                                                         #
  937.     ###########################################################################
  938.  
  939.     def @IntroFullPlace   { @Galley }
  940.     def @IntroColPlace    { @Galley }
  941.  
  942.     def @IntroColList right col
  943.     {
  944.     def @Column
  945.     {
  946.         @VExpand { @IntroColPlace //1rt @OneRow { //@MidGap @ColFootSect } }
  947.     }
  948.  
  949.     col @Case {
  950.  
  951.         Single @Yield @Column
  952.  
  953.         Double @Yield { @DoubleColWidth @Wide @Column
  954.                 ||@ColGap @IntroColList col }
  955.  
  956.         Multi  @Yield { @MultiColWidth @Wide @Column
  957.                 ||@ColGap @IntroColList col }
  958.  
  959.     }
  960.     }
  961.  
  962.     ###########################################################################
  963.     #                                                                         #
  964.     #  Page layout for documents other than books (simple and tech. reports)  #
  965.     #                                                                         #
  966.     ###########################################################################
  967.  
  968.     def @SimplePageList
  969.     named @Columns {}
  970.     named @PageNumbers {}
  971.     right @PageNum
  972.     {
  973.             @PageMarker @PageNum
  974.     //  @OnePage
  975.             @Columns { @Columns }
  976.             @PageTop {
  977.             @PageNumbers @Case
  978.             {
  979.                 {Yes yes} @Yield
  980.                 {
  981.                 @PageNum @Case
  982.                 {
  983.                     1    @Yield @PageOneTopFormat @PageNum
  984.                     else @Yield @PageTopFormat    @PageNum
  985.                 }
  986.                 }
  987.                 else @Yield @Null
  988.             }
  989.             }
  990.             @PageFoot {
  991.             @PageNumbers @Case
  992.             {
  993.             {Yes yes} @Yield
  994.             {
  995.                 @PageNum @Case
  996.                 {
  997.                 1    @Yield @PageOneFootFormat @PageNum
  998.                 else @Yield @PageFootFormat    @PageNum
  999.                 }
  1000.             }
  1001.             else @Yield @Null
  1002.             }
  1003.         }
  1004.     //  @SimplePageList
  1005.         @Columns { @Columns }
  1006.         @PageNumbers { @PageNumbers }
  1007.         @Next @PageNum
  1008.     }
  1009.  
  1010.  
  1011.     ###########################################################################
  1012.     #                                                                         #
  1013.     #  Page list for ordinary pages of books.                                 #
  1014.     #                                                                         #
  1015.     ###########################################################################
  1016.  
  1017.     def @OddPageList
  1018.     named @Columns {}
  1019.     right @PageNum
  1020.     {
  1021.     def @EvenPageList
  1022.         named @Columns {}
  1023.         right @PageNum
  1024.     {
  1025.         @PageMarker @PageNum
  1026.         //    @Runner&&following @Open
  1027.         {
  1028.             @OnePage
  1029.             @Columns { @Columns }
  1030.             @PageTop { @TopEven @PageNum }
  1031.             @PageFoot { @FootEven @PageNum }
  1032.         }
  1033.         //    @OddPageList
  1034.             @Columns { @Columns }
  1035.             @Next @PageNum
  1036.     }
  1037.  
  1038.         @PageMarker @PageNum
  1039.     //  @Runner&&following @Open
  1040.         {
  1041.         @OnePage
  1042.             @Columns { @Columns }
  1043.             @PageTop { @TopOdd @PageNum }
  1044.             @PageFoot { @FootOdd @PageNum }
  1045.         }
  1046.     //  @EvenPageList
  1047.         @Columns { @Columns }
  1048.         @Next @PageNum
  1049.     }
  1050.  
  1051.  
  1052.     ###########################################################################
  1053.     #                                                                         #
  1054.     #  Page list for introductory pages of books.  Unlike @OddPageList and    #
  1055.     #  @EvenPageList, this one always generates an even number of pages.      #
  1056.     #                                                                         #
  1057.     ###########################################################################
  1058.  
  1059.     def @IntroOddPageList
  1060.     named @Columns {}
  1061.     right @PageNum
  1062.     {
  1063.         @PageMarker @Roman&&@PageNum
  1064.     //  @Runner&&following @Open
  1065.         {
  1066.         @Page {
  1067.             @TopOdd @Roman&&@PageNum
  1068.             //@MidGap @TopList
  1069.             //@MidGap @IntroFullPlace
  1070.             //@MidGap @IntroColList @Columns
  1071.             //@MidGap @IndexColList @IndexColumns
  1072.             // //1rt @OneRow
  1073.             {  //@MidGap @FootSect
  1074.                //@MidGap @FootOdd @Roman&&@PageNum
  1075.             }
  1076.         }
  1077.         }
  1078.     //  @PageMarker @Roman&&{@Next @PageNum}
  1079.     //  @Runner&&following @Open
  1080.         {
  1081.         @Page {
  1082.             @TopEven @Roman&&{@Next @PageNum}
  1083.             //@MidGap @TopList
  1084.             //@MidGap @IntroFullPlace
  1085.             //@MidGap @IntroColList @Columns
  1086.             //@MidGap @IndexColList @IndexColumns
  1087.             // //1rt @OneRow
  1088.             {    //@MidGap @FootSect
  1089.             //@MidGap @FootEven @Roman&&{@Next @PageNum}
  1090.             }
  1091.         }
  1092.         }
  1093.     //  @IntroOddPageList
  1094.         @Columns { @Columns }
  1095.         @Next @Next @PageNum
  1096.     }
  1097.  
  1098.  
  1099.     ###########################################################################
  1100.     #                                                                         #
  1101.     #  Table of contents.                                                     #
  1102.     #                                                                         #
  1103.     ###########################################################################
  1104.  
  1105.     def @ContentsPlace { @Galley }
  1106.  
  1107.     def @ContentsEntry
  1108.     left lpart
  1109.     named pregap { @ContentsGap }
  1110.     right rpart
  1111.     {
  1112.     def @Leaders { .. &4s @Leaders }
  1113.  
  1114.     def sendentry into { @ContentsPlace&&preceding }
  1115.     {
  1116.         //pregap
  1117.         lpart |1rt &2s @Leaders & 2f @Wide {|1rt rpart}
  1118.     }
  1119.  
  1120.     @TableOfContents @Case {
  1121.         {Yes yes} @Yield sendentry
  1122.         else      @Yield @Null
  1123.     }
  1124.     }
  1125.  
  1126.     def @MajorContentsEntry
  1127.     left lpart
  1128.     named pregap { @MajorContentsGap }
  1129.     right rpart
  1130.     {
  1131.     {@B lpart} @ContentsEntry pregap { pregap } rpart
  1132.     }
  1133.  
  1134.     def @ContentsSection
  1135.     {
  1136.     def @ContentsList { @ContentsPlace // @ContentsList }
  1137.  
  1138.     @TableOfContents @Case {
  1139.         {Yes yes} @Yield { @BookTitleFormat @ContentsWord // @ContentsList }
  1140.         else      @Yield @Null
  1141.     }
  1142.     }
  1143.  
  1144.  
  1145.     ###########################################################################
  1146.     #                                                                         #
  1147.     #  Footnotes.                                                             #
  1148.     #                                                                         #
  1149.     ###########################################################################
  1150.  
  1151.     def @FullFootNote
  1152.     named @Tag {}
  1153.     right x
  1154.     {
  1155.     def ftag
  1156.     { @OneRow { @FootList&&@Tag @Open { 0.8f @Font @Tag } ^/0.3vo }
  1157.     }
  1158.  
  1159.     def fnote into { @FootList&&following }
  1160.     {
  1161.         @FootNoteFont @Font @FootNoteBreak @Break
  1162.         { @FootList&&preceding @Tagged @Tag  ftag & x }
  1163.     }
  1164.  
  1165.     @Null & @FootNoteFont @Font ftag & fnote
  1166.     }
  1167.  
  1168.     def @ColFootNote
  1169.     named @Tag {}
  1170.     right x
  1171.     {
  1172.     def ftag
  1173.     { @OneRow { @ColFootList&&@Tag @Open { 0.8f @Font @Tag } ^/0.3vo }
  1174.     }
  1175.  
  1176.     def fnote into { @ColFootList&&following }
  1177.     {
  1178.         @FootNoteFont @Font @FootNoteBreak @Break
  1179.         { @ColFootList&&preceding @Tagged @Tag  ftag & x }
  1180.     }
  1181.  
  1182.     @Null & @FootNoteFont @Font ftag & fnote
  1183.     }
  1184.  
  1185.  
  1186.     ###########################################################################
  1187.     #                                                                         #
  1188.     #  References.                                                            #
  1189.     #                                                                         #
  1190.     ###########################################################################
  1191.  
  1192.     export  @Type @Author @Title @Institution
  1193.         @Number @Publisher @Year @Proceedings
  1194.         @Journal @Volume @Pages @Comment
  1195.  
  1196.     def @Reference
  1197.     named @Tag          { TAG?         }
  1198.     named @Type         { TYPE?        }
  1199.     named @Author       { AUTHOR?      }
  1200.     named @Title        { TITLE?       }
  1201.     named @Institution  { INSTITUTION? }
  1202.     named @Number       { NUMBER?      }
  1203.     named @Publisher    { PUBLISHER?   }
  1204.     named @Year         { YEAR?        }
  1205.     named @Proceedings  { PROCEEDINGS? }
  1206.     named @Journal      { JOURNAL?     }
  1207.     named @Volume       { VOLUME?      }
  1208.     named @Pages        { PAGES?       }
  1209.     named @Comment      { @Null        }
  1210.     { @Null }
  1211.  
  1212.     export @Style
  1213.     def @RefStyle
  1214.     left @Tag
  1215.     named @Style right reftag {}
  1216.     {}
  1217.  
  1218.     @SysDatabase @RefStyle { "refstyles" }
  1219.  
  1220.     def @RefPrint right reftag
  1221.     {    @RefStyle&&{ @Reference&&reftag @Open { @Type } }
  1222.     @Open { @Style reftag }
  1223.     }
  1224.  
  1225.  
  1226.     ###########################################################################
  1227.     #                                                                         #
  1228.     #  Reference collection at end of chapter.                                #
  1229.     #                                                                         #
  1230.     ###########################################################################
  1231.  
  1232.     def @ChapRefPlace { @Galley }
  1233.  
  1234.     def @ChapRefSection
  1235.     named @Title        { @ReferencesWord }
  1236.     named style right tag    { tag. }
  1237.     named indent        { @DispIndent }
  1238.     named gap        { @DispGap }
  1239.     named start        { 1 }
  1240.     {
  1241.     def @RefList right num
  1242.     {
  1243.         @NumberMarker num &
  1244.         indent @Wide {style num}  |  @ChapRefPlace
  1245.         //gap @RefList @Next num
  1246.     }
  1247.  
  1248.     @Heading @Protect @Title
  1249.     //@DispGap
  1250.     @RefList start
  1251.     }
  1252.  
  1253.     def @ChapRef right x
  1254.     {
  1255.     def sendref into { @ChapRefPlace&&following }
  1256.         right @Key
  1257.     {
  1258.         @NumberMarker&&preceding @Tagged x &
  1259.         @PageMarker&&preceding @Tagged x &
  1260.         @RefPrint x
  1261.     }
  1262.  
  1263.     @NumberMarker&&x @Open { @Tag } sendref x
  1264.     }
  1265.  
  1266.  
  1267.     ###########################################################################
  1268.     #                                                                         #
  1269.     #  Reference collection at end of document.                               #
  1270.     #                                                                         #
  1271.     ###########################################################################
  1272.  
  1273.     def @RefPlace { @Galley }
  1274.  
  1275.     def @Ref right x
  1276.     {
  1277.     def sendref into { @RefPlace&&following }
  1278.         right @Key
  1279.     {
  1280.         @NumberMarker&&preceding @Tagged x &
  1281.         @PageMarker&&preceding @Tagged x &
  1282.         @RefPrint x
  1283.     }
  1284.  
  1285.     @NumberMarker&&x @Open { @Tag } sendref x
  1286.     }
  1287.  
  1288.     def @ReferenceSection
  1289.     named @Tag        {}
  1290.     named @Title        { @ReferencesWord }
  1291.     named @RunningTitle    { dft }
  1292.     named style right tag    { tag. }
  1293.     named headstyle right @Title { @Heading @Title }
  1294.     named indent        { @DispIndent }
  1295.     named gap        { @DispGap }
  1296.     named start        { 1 }
  1297.     {
  1298.     def @RefList right num
  1299.     {
  1300.         @NumberMarker num &
  1301.         indent @Wide {style num}  |  @RefPlace
  1302.         //gap @RefList @Next num
  1303.     }
  1304.  
  1305.         @Protect headstyle @Title
  1306.     //  @PageMarker&&preceding @Tagged @Tag
  1307.     //  @Title @MajorContentsEntry {@PageOf @Tag}
  1308.     //  @Runner
  1309.         @FootEven { |0.5rt 0.8f @Font @B @PageNum }
  1310.         @FootOdd  { |0.5rt 0.8f @Font @B @PageNum }
  1311.     //@DispGap  @RefList start
  1312.     //  @Runner
  1313.         @TopEven { @B @PageNum }
  1314.         @TopOdd  {
  1315.           @RunningTitles @Case {
  1316.             { Yes yes } @Yield @I {@RunningTitle @OrElse @Title}
  1317.             else        @Yield {}
  1318.           }
  1319.           |1rt @B @PageNum
  1320.         }
  1321.     }
  1322.  
  1323.  
  1324.     ###########################################################################
  1325.     #                                                                         #
  1326.     #  Floating figures.                                                      #
  1327.     #                                                                         #
  1328.     ###########################################################################
  1329.  
  1330.     def @FigurePlace { @Galley }
  1331.     def @EndFigurePlace { @Galley }
  1332.  
  1333.     def @FigureGalley into { @TopList&&following }
  1334.     right prefix
  1335.     {
  1336.     def @FigureList right x
  1337.     {
  1338.         @NumberMarker {prefix}x & ||0.5rt @FigurePlace ||
  1339.         //@TopGap
  1340.         @FigureList @Next x
  1341.     }
  1342.  
  1343.     @FigureList 1
  1344.     //
  1345.     @EndFigurePlace
  1346.     }
  1347.  
  1348.     def @EndFigures force into { @EndFigurePlace&&following } {}
  1349.  
  1350.     def @Figure into { @FigurePlace&&following }
  1351.     named @Caption {}
  1352.     named @Tag {}
  1353.     right @Body
  1354.     {
  1355.     @OneRow
  1356.     {
  1357.         ||0.5rt @HContract @Body
  1358.         //@DispGap
  1359.         ||0.5rt
  1360.         @NumberMarker&&preceding @Tagged @Tag
  1361.         @PageMarker&&preceding @Tagged @Tag
  1362.         @B { @FigureWord {@NumberOf @Tag}. }  @Caption
  1363.     }
  1364.     }
  1365.  
  1366.  
  1367.     ###########################################################################
  1368.     #                                                                         #
  1369.     #  Floating tables.                                                       #
  1370.     #                                                                         #
  1371.     ###########################################################################
  1372.  
  1373.     def @TablePlace { @Galley }
  1374.     def @EndTablePlace { @Galley }
  1375.  
  1376.     def @TableGalley into { @TopList&&following }
  1377.     right prefix
  1378.     {
  1379.     def @TableList right x
  1380.     {
  1381.         @NumberMarker {prefix}x & ||0.5rt @TablePlace ||
  1382.         //@TopGap
  1383.         @TableList @Next x
  1384.     }
  1385.  
  1386.     @TableList 1
  1387.     //
  1388.     @EndTablePlace
  1389.     }
  1390.  
  1391.     def @EndTables force into { @EndTablePlace&&following } {}
  1392.  
  1393.     def @Table into { @TablePlace&&following }
  1394.     named @Caption {}
  1395.     named @Tag {}
  1396.     right @Body
  1397.     {
  1398.     @OneRow
  1399.     {
  1400.         ||0.5rt @HContract @Body
  1401.         //@DispGap
  1402.         ||0.5rt
  1403.         @NumberMarker&&preceding @Tagged @Tag
  1404.         @PageMarker&&preceding @Tagged @Tag
  1405.         @B { @TableWord {@NumberOf @Tag}. }  @Caption
  1406.     }
  1407.     }
  1408.  
  1409.  
  1410.     ###########################################################################
  1411.     #                                                                         #
  1412.     #  Lists of chapters, sections, subsections, and appendices.              #
  1413.     #                                                                         #
  1414.     ###########################################################################
  1415.  
  1416.     export @Tag
  1417.     def @ChapterList right @Tag
  1418.     {
  1419.                 @Galley
  1420.     //@ChapterGap        @ChapterList @Next @Tag
  1421.     }
  1422.  
  1423.     export @Tag
  1424.     def @SectionList right @Tag
  1425.     {
  1426.                 @Galley
  1427.         //@SectionGap        @SectionList @Next @Tag
  1428.     }
  1429.  
  1430.     export @Tag
  1431.     def @SubSectionList right @Tag
  1432.     {
  1433.                 @Galley
  1434.     //@SubSectionGap    @SubSectionList @Next @Tag
  1435.     }
  1436.  
  1437.     export @Tag
  1438.     def @AppendixList right @Tag
  1439.     {
  1440.                 @Galley
  1441.     //@AppendixGap        @AppendixList @Next @Tag
  1442.     }
  1443.  
  1444.     export @Tag
  1445.     def @SubAppendixList right @Tag
  1446.     {
  1447.                 @Galley
  1448.     //@SubAppendixGap   @SubAppendixList @Next @Tag
  1449.     }
  1450.  
  1451.  
  1452.     ###########################################################################
  1453.     #                                                                         #
  1454.     #  Body text.                                                             #
  1455.     #                                                                         #
  1456.     ###########################################################################
  1457.  
  1458.     export @ColText @FootNote
  1459.        @BeginSections @EndSections @BeginAppendices @EndAppendices
  1460.  
  1461.     def @Text force into { @FullPlace&&preceding }
  1462.     body x
  1463.     {
  1464.     def @FootNote right x { @FullFootNote x }
  1465.  
  1466.     def @EndSectionsPlace { @Galley }
  1467.     def @EndSections force into { @EndSectionsPlace&&preceding }  {}
  1468.     macro @BeginSections
  1469.           { //@SectionGap @SectionList 1 // @EndSectionsPlace // }
  1470.  
  1471.     def @EndAppendicesPlace { @Galley }
  1472.     def @EndAppendices force into { @EndAppendicesPlace&&preceding }  {}
  1473.     macro @BeginAppendices
  1474.           { //@AppendixGap @AppendixList 1 // @EndAppendicesPlace //}
  1475.  
  1476.  
  1477.     export @FootNote
  1478.     def @ColText force into { @ColPlace&&following }
  1479.         body x
  1480.     {
  1481.         def @FootNote right x { @ColFootNote x }
  1482.     
  1483.         x
  1484.     }
  1485.  
  1486.     x
  1487.     }
  1488.  
  1489.     export @FootNote
  1490.        @BeginSections @EndSections @BeginAppendices @EndAppendices
  1491.     def @ColText force into { @ColPlace&&preceding }
  1492.     body x
  1493.     {
  1494.     def @FootNote right x { @ColFootNote x }
  1495.  
  1496.     def @EndSectionsPlace { @Galley }
  1497.     def @EndSections force into { @EndSectionsPlace&&preceding }  {}
  1498.     macro @BeginSections
  1499.           { //@SectionGap @SectionList 1 // @EndSectionsPlace // }
  1500.  
  1501.     def @EndAppendicesPlace { @Galley }
  1502.     def @EndAppendices force into { @EndAppendicesPlace&&preceding }  {}
  1503.     macro @BeginAppendices
  1504.           { //@AppendixGap @AppendixList 1 // @EndAppendicesPlace //}
  1505.     x
  1506.     }
  1507.  
  1508.  
  1509.     ###########################################################################
  1510.     #                                                                         #
  1511.     #  Abstract.                                                              #
  1512.     #                                                                         #
  1513.     ###########################################################################
  1514.  
  1515.     def @AbstractPlace { @Galley }
  1516.  
  1517.     export @FootNote
  1518.     def @Abstract into { @AbstractPlace&&preceding }
  1519.     named @Title { @AbstractWord }
  1520.     body x
  1521.     {  
  1522.     def @FootNote right x { @FullFootNote x }
  1523.  
  1524.     |0.5rt @I @Title
  1525.     //@DispGap x
  1526.     }
  1527.  
  1528.  
  1529.     ###########################################################################
  1530.     #                                                                         #
  1531.     #  Preface.                                                               #
  1532.     #                                                                         #
  1533.     ###########################################################################
  1534.  
  1535.     def @PrefacePlace { @Galley }
  1536.  
  1537.     export @FootNote @BeginFigures @BeginTables
  1538.     def @Preface force into { @PrefacePlace&&preceding }
  1539.     named @Tag {}
  1540.     named @Title { @PrefaceWord }
  1541.     named @RunningTitle { dft }
  1542.     body @Body
  1543.     {
  1544.     def @FootNote right x { @ColFootNote x }
  1545.     macro @BeginFigures { @FigureGalley {} }
  1546.     macro @BeginTables  { @TableGalley  {} }
  1547.  
  1548.         ragged @Break @BookTitleFormat @Title
  1549.     //  @PageMarker&&preceding @Tagged @Tag
  1550.     //  @Body
  1551.     //@SectionGap    @ChapRefSection
  1552.     }
  1553.  
  1554.  
  1555.     ###########################################################################
  1556.     #                                                                         #
  1557.     #  Introduction.                                                          #
  1558.     #                                                                         #
  1559.     ###########################################################################
  1560.  
  1561.     def @IntroductionPlace { @Galley }
  1562.  
  1563.     export @FootNote @BeginFigures @BeginTables
  1564.     def @Introduction force into { @IntroductionPlace&&preceding }
  1565.     named @Tag {}
  1566.     named @Title { @IntroductionWord }
  1567.     named @RunningTitle { dft }
  1568.     body @Body
  1569.     {
  1570.     def @FootNote right x { @ColFootNote x }
  1571.     macro @BeginFigures { @FigureGalley {} }
  1572.     macro @BeginTables  { @TableGalley  {} }
  1573.  
  1574.         ragged @Break @BookTitleFormat @Title
  1575.     //  @Runner
  1576.         @FootEven { |0.5rt 0.8f @Font @B @PageNum }
  1577.         @FootOdd  { |0.5rt 0.8f @Font @B @PageNum }
  1578.     //  @PageMarker&&preceding @Tagged @Tag
  1579.     //  @Title @MajorContentsEntry {@PageOf @Tag}
  1580.     //  @Body
  1581.     //@SectionGap    @ChapRefSection
  1582.     //  @Runner
  1583.         @TopEven { @B @PageNum }
  1584.         @TopOdd  {
  1585.           @RunningTitles @Case {
  1586.             { Yes yes } @Yield @I {@RunningTitle @OrElse @Title}
  1587.             else        @Yield {}
  1588.           }
  1589.           |1rt @B @PageNum
  1590.         }
  1591.     }
  1592.  
  1593.  
  1594.     ###########################################################################
  1595.     #                                                                         #
  1596.     #  Chapters containing sections and subsections.                          #
  1597.     #                                                                         #
  1598.     ###########################################################################
  1599.  
  1600.     export @FootNote @BeginFigures @BeginTables
  1601.        @BeginSections @EndSections @Section
  1602.     def @Chapter force into { @ChapterList&&preceding }
  1603.     named @Tag {}
  1604.     named @Title {}
  1605.     named @RunningTitle { dft }
  1606.     body @Body
  1607.     {
  1608.     def @FootNote right x { @ColFootNote x }
  1609.     macro @BeginFigures { @FigureGalley {@NumberOf @Tag}. }
  1610.     macro @BeginTables  { @TableGalley  {@NumberOf @Tag}. }
  1611.  
  1612.     def @EndSectionsPlace { @Galley }
  1613.     def @EndSections force into { @EndSectionsPlace&&preceding } {}
  1614.     macro @BeginSections
  1615.           { //@SectionGap @SectionList 1 // @EndSectionsPlace // }
  1616.  
  1617.     export @BeginSubSections @EndSubSections @SubSection
  1618.     def @Section force into { @SectionList&&preceding }
  1619.         named @Tag {}
  1620.         named @Title {}
  1621.         named @RunningTitle { dft }
  1622.         body @Body
  1623.     {
  1624.  
  1625.         def @EndSubSectsPlace { @Galley }
  1626.         def @EndSubSections force into { @EndSubSectsPlace&&preceding } {}
  1627.         macro @BeginSubSections
  1628.          { //@SubSectionGap @SubSectionList 1// @EndSubSectsPlace//}
  1629.  
  1630.         def @SubSection force into { @SubSectionList&&preceding }
  1631.         named @Tag {}
  1632.         named @Title {}
  1633.             named @RunningTitle { dft }
  1634.         body @Body
  1635.         {
  1636.         def @SubSectionTitle
  1637.         {
  1638.             @SubSectionNumbers @Case {
  1639.             {Yes yes} @Yield { {@NumberOf @Tag}.  |2s  @Title }
  1640.             else      @Yield @Title
  1641.             }
  1642.         }
  1643.  
  1644.             @MinorHeading @Protect @SubSectionTitle
  1645.         //  @NumberMarker {
  1646.             {@ChapterList&&@Tag    @Open { @Tag }}.{
  1647.              @SectionList&&@Tag    @Open { @Tag }}.{
  1648.              @SubSectionList&&@Tag @Open { @Tag }}
  1649.             }
  1650.         //  @ChapterList&&preceding     @Tagged @Tag
  1651.         //  @SectionList&&preceding     @Tagged @Tag
  1652.         //  @SubSectionList&&preceding  @Tagged @Tag
  1653.         //  @NumberMarker&&preceding    @Tagged @Tag
  1654.         //  @PageMarker&&preceding      @Tagged @Tag
  1655.         //  {&5f @SubSectionTitle} @ContentsEntry {@PageOf @Tag}
  1656.         //0io @Body
  1657.         }
  1658.  
  1659.         def @SectionTitle
  1660.         {
  1661.         @SectionNumbers @Case {
  1662.             {Yes yes} @Yield { {@NumberOf @Tag}.  |2s  @Title }
  1663.             else      @Yield @Title
  1664.         }
  1665.         }
  1666.  
  1667.             @Heading @Protect @SectionTitle
  1668.         //  @NumberMarker {
  1669.             {@ChapterList&&@Tag @Open { @Tag }}.{
  1670.              @SectionList&&@Tag @Open { @Tag }}
  1671.         }
  1672.         //  @ChapterList&&preceding  @Tagged @Tag
  1673.         //  @SectionList&&preceding  @Tagged @Tag
  1674.         //  @NumberMarker&&preceding @Tagged @Tag
  1675.         //  @PageMarker&&preceding   @Tagged @Tag
  1676.         //  { &3f @SectionTitle } @ContentsEntry {@PageOf @Tag}
  1677.         //0io @Body
  1678.  
  1679.     }
  1680.  
  1681.     def @ChapterTitle
  1682.     {
  1683.         @ChapterNumbers @Case {
  1684.         {Yes yes} @Yield { @ChapterWord {@NumberOf @Tag}.  |2s  @Title }
  1685.         else      @Yield @Title
  1686.         }
  1687.     }
  1688.  
  1689.     def @ChapterNum
  1690.     {
  1691.         @ChapterNumbers @Case {
  1692.         {Yes yes} @Yield { @ChapterWord {@NumberOf @Tag} }
  1693.         else      @Yield @Null
  1694.         }
  1695.     }
  1696.  
  1697.         ragged @Break @BookTitleFormat @ChapterTitle
  1698.     //  @NumberMarker {
  1699.         @ChapterList&&@Tag @Open { @Tag }
  1700.         }
  1701.     //  @ChapterList&&preceding  @Tagged @Tag
  1702.     //  @NumberMarker&&preceding @Tagged @Tag
  1703.     //  @PageMarker&&preceding   @Tagged @Tag
  1704.     //  { @ChapterTitle } @MajorContentsEntry {@PageOf @Tag}
  1705.     //  @Runner
  1706.         @FootEven { |0.5rt 0.8f @Font @B @PageNum }
  1707.         @FootOdd  { |0.5rt 0.8f @Font @B @PageNum }
  1708.     //  @Body
  1709.     //@SectionGap @ChapRefSection
  1710.     //  @Runner
  1711.         @TopEven { @B @PageNum |1rt @I @ChapterNum }
  1712.         @TopOdd  {
  1713.           @RunningTitles @Case {
  1714.             { Yes yes } @Yield @I {@RunningTitle @OrElse @Title}
  1715.             else        @Yield {}
  1716.           }
  1717.           |1rt @B @PageNum
  1718.         }
  1719.     }
  1720.  
  1721.  
  1722.     ###########################################################################
  1723.     #                                                                         #
  1724.     #  Sections containing subsections.                                       #
  1725.     #                                                                         #
  1726.     ###########################################################################
  1727.  
  1728.     export @FootNote @BeginFigures @BeginTables
  1729.        @BeginSubSections @SubSection @EndSubSections
  1730.     def @Section force into { @SectionList&&preceding }
  1731.     named @Tag {}
  1732.     named @Title {}
  1733.     named @RunningTitle { dft }
  1734.     body @Body
  1735.     {
  1736.     def @FootNote right x { @ColFootNote x }
  1737.     macro @BeginFigures { @FigureGalley {@NumberOf @Tag}. }
  1738.     macro @BeginTables  { @TableGalley  {@NumberOf @Tag}. }
  1739.  
  1740.     def @EndSubSectsPlace { @Galley }
  1741.     def @EndSubSections force into { @EndSubSectsPlace&&preceding }  {}
  1742.     macro @BeginSubSections
  1743.       { //@SubSectionGap @SubSectionList 1 // @EndSubSectsPlace // }
  1744.  
  1745.     def @SubSection force into { @SubSectionList&&preceding }
  1746.         named @Tag {}
  1747.         named @Title {}
  1748.         named @RunningTitle { dft }
  1749.         right @Body
  1750.     {
  1751.         def @SubSectionTitle
  1752.         {
  1753.         @SubSectionNumbers @Case {
  1754.             {Yes yes} @Yield { {@NumberOf @Tag}.  |2s  @Title }
  1755.             else      @Yield @Title
  1756.         }
  1757.         }
  1758.  
  1759.             @MinorHeading @Protect @SubSectionTitle
  1760.         //    @NumberMarker {
  1761.             {@SectionList&&@Tag @Open { @Tag }}.{
  1762.              @SubSectionList&&@Tag @Open { @Tag }}
  1763.         }
  1764.         //    @SubSectionList&&preceding @Tagged @Tag
  1765.         //    @SectionList&&preceding    @Tagged @Tag
  1766.         //    @NumberMarker&&preceding   @Tagged @Tag
  1767.         //    @PageMarker&&preceding     @Tagged @Tag
  1768.         //0io @Body
  1769.     }
  1770.  
  1771.     def @SectionTitle
  1772.     {
  1773.         @SectionNumbers @Case {
  1774.         {Yes yes} @Yield { {@NumberOf @Tag}.  |2s  @Title }
  1775.         else      @Yield @Title
  1776.         }
  1777.     }
  1778.  
  1779.         @Heading @Protect @SectionTitle
  1780.     //  @NumberMarker {
  1781.         @SectionList&&@Tag @Open { @Tag }
  1782.         }
  1783.     //  @SectionList&&preceding  @Tagged @Tag
  1784.     //  @NumberMarker&&preceding @Tagged @Tag
  1785.     //  @PageMarker&&preceding   @Tagged @Tag
  1786.     //0io @Body
  1787.     }
  1788.  
  1789.  
  1790.     ###########################################################################
  1791.     #                                                                         #
  1792.     #  Appendices.                                                            #
  1793.     #                                                                         #
  1794.     ###########################################################################
  1795.  
  1796.     export @FootNote @BeginFigures @BeginTables
  1797.        @BeginSubAppendices @SubAppendix @EndSubAppendices
  1798.     def @Appendix force into { @AppendixList&&preceding }
  1799.     named @Tag {}
  1800.     named @Title {}
  1801.     named @RunningTitle { dft }
  1802.     body  @Body
  1803.     {
  1804.     def @FootNote right x { @ColFootNote x }
  1805.     macro @BeginFigures { @FigureGalley {@NumberOf @Tag}. }
  1806.     macro @BeginTables  { @TableGalley  {@NumberOf @Tag}. }
  1807.  
  1808.     def @EndSubAppendicesPlace { @Galley }
  1809.     def @EndSubAppendices force into {@EndSubAppendicesPlace&&preceding} {}
  1810.     macro @BeginSubAppendices
  1811.       { //@SubAppendixGap @SubAppendixList 1 // @EndSubAppendicesPlace // }
  1812.  
  1813.     def @SubAppendix force into { @SubAppendixList&&preceding }
  1814.         named @Tag {}
  1815.         named @Title {}
  1816.         named @RunningTitle { dft }
  1817.         right @Body
  1818.     {
  1819.         def @SubAppendixTitle
  1820.         {
  1821.         @SubAppendixNumbers @Case {
  1822.             {Yes yes} @Yield { {@NumberOf @Tag}.  |2s  @Title }
  1823.             else      @Yield @Title
  1824.         }
  1825.         }
  1826.  
  1827.             @Heading @Protect @SubAppendixTitle
  1828.         //    @NumberMarker {
  1829.             {@AppendixList&&@Tag @Open { @Tag }}.{
  1830.              @SubAppendixList&&@Tag @Open { @Tag }}
  1831.         }
  1832.         //    @SubAppendixList&&preceding @Tagged @Tag
  1833.         //    @AppendixList&&preceding    @Tagged @Tag
  1834.         //    @NumberMarker&&preceding   @Tagged @Tag
  1835.         //    @PageMarker&&preceding     @Tagged @Tag
  1836.         //    @SubAppendixTitle @ContentsEntry {@PageOf @Tag}
  1837.         //0io @Body
  1838.     }
  1839.  
  1840.     def @AppendixTitle
  1841.     {
  1842.         @AppendixNumbers @Case {
  1843.         {Yes yes} @Yield { @AppendixWord {@NumberOf @Tag}. |2s @Title }
  1844.         else      @Yield { @AppendixWord.  @Title }
  1845.         }
  1846.     }
  1847.  
  1848.     def @AppendixNum
  1849.     {
  1850.         @AppendixNumbers @Case {
  1851.         {Yes yes} @Yield { @NumberOf @Tag }
  1852.         else      @Yield @Null
  1853.         }
  1854.     }
  1855.  
  1856.         ragged @Break @BookTitleFormat @AppendixTitle
  1857.     //  @NumberMarker {
  1858.         @AppendixList&&@Tag @Open { @UCAlpha&&@Tag }
  1859.         }
  1860.     //  @AppendixList&&preceding @Tagged @Tag
  1861.     //  @NumberMarker&&preceding @Tagged @Tag
  1862.     //  @PageMarker&&preceding   @Tagged @Tag
  1863.     //  @AppendixTitle @MajorContentsEntry {@PageOf @Tag}
  1864.     //  @Runner
  1865.         @FootEven { |0.5rt 0.8f @Font @B @PageNum }
  1866.         @FootOdd  { |0.5rt 0.8f @Font @B @PageNum }
  1867.     //  @Body
  1868.     //@SectionGap @ChapRefSection
  1869.     //  @Runner
  1870.         @TopEven { @B @PageNum |1rt @I { @AppendixWord @AppendixNum } }
  1871.         @TopOdd  {
  1872.           @RunningTitles @Case {
  1873.             { Yes yes } @Yield @I {@RunningTitle @OrElse @Title}
  1874.             else        @Yield {}
  1875.           }
  1876.           |1rt @B @PageNum
  1877.         }
  1878.     }
  1879.  
  1880.  
  1881.     ###########################################################################
  1882.     #                                                                         #
  1883.     #  Index.                                                                 #
  1884.     #                                                                         #
  1885.     ###########################################################################
  1886.  
  1887.     def @IndexList { @Galley //1vx @IndexList }
  1888.  
  1889.     def @IndexSection
  1890.     named @Tag {}
  1891.     named @Title { @IndexWord }
  1892.     named @RunningTitle { dft }
  1893.     named headstyle right @Title { @Heading @Title //@DispGap }
  1894.     {
  1895.  
  1896.     def @IndexBody into { @IndexPlace&&following }
  1897.     { // @IndexList
  1898.       // @Runner
  1899.         @TopEven { @B @PageNum }
  1900.         @TopOdd  {
  1901.           @RunningTitles @Case {
  1902.             { Yes yes } @Yield @I {@RunningTitle @OrElse @Title}
  1903.             else        @Yield {}
  1904.           }
  1905.           |1rt @B @PageNum
  1906.         }
  1907.     }
  1908.  
  1909.         def indexsection
  1910.         {
  1911.         headstyle @Title
  1912.         //    @PageMarker&&preceding @Tagged @Tag
  1913.         //    @Title @MajorContentsEntry {@PageOf @Tag}
  1914.         //    @Runner
  1915.             @FootEven { |0.5rt 0.8f @Font @B @PageNum }
  1916.             @FootOdd  { |0.5rt 0.8f @Font @B @PageNum }
  1917.         //    @IndexBody
  1918.         }
  1919.  
  1920.     @MakeIndex @Case {
  1921.         {Yes yes} @Yield indexsection
  1922.         else      @Yield @Null
  1923.     }
  1924.     }
  1925.  
  1926.     def @SendIndex
  1927.     left key
  1928.     right @Body
  1929.     {
  1930.         def sendindex into { @IndexList&&following }
  1931.         left @Key
  1932.         right @Body
  1933.     {
  1934.         outdent @Break @Body
  1935.     }
  1936.  
  1937.     @MakeIndex @Case {
  1938.         {Yes yes} @Yield {key sendindex @Body}
  1939.         else      @Yield @Null
  1940.     }
  1941.     }
  1942.  
  1943.     def @RawIndex       left x right y { {@PageMark x} x @SendIndex { &0f y } }
  1944.     def @RawSubIndex    left x right y { {@PageMark x} x @SendIndex { &1f y } }
  1945.     def @RawSubSubIndex left x right y { {@PageMark x} x @SendIndex { &2f y } }
  1946.  
  1947.     def @Index       left x right y { x @RawIndex       { y, {@PageOf x} } }
  1948.     def @SubIndex    left x right y { x @RawSubIndex    { y, {@PageOf x} } }
  1949.     def @SubSubIndex left x right y { x @RawSubSubIndex { y, {@PageOf x} } }
  1950.  
  1951.     def @IndexBlanks
  1952.     {
  1953.     b @RawIndex {} c @RawIndex {} d @RawIndex {} e @RawIndex {}
  1954.     f @RawIndex {} g @RawIndex {} h @RawIndex {} i @RawIndex {}
  1955.     j @RawIndex {} k @RawIndex {} l @RawIndex {} m @RawIndex {}
  1956.     n @RawIndex {} o @RawIndex {} p @RawIndex {} q @RawIndex {}
  1957.     r @RawIndex {} s @RawIndex {} t @RawIndex {} u @RawIndex {}
  1958.     v @RawIndex {} w @RawIndex {} x @RawIndex {} y @RawIndex {}
  1959.     z @RawIndex {}
  1960.     }
  1961.  
  1962.  
  1963.     ###########################################################################
  1964.     #                                                                         #
  1965.     #  Document.                                                              #
  1966.     #                                                                         #
  1967.     ###########################################################################
  1968.  
  1969.     def @Document
  1970.     named @InitialFont { @InitialFont }
  1971.     named @InitialBreak { @InitialBreak }
  1972.     named @Hyphenate { @Hyphenate }
  1973.     named @PageNumbers { @PageNumbers }
  1974.     named @FirstPageNumber { @FirstPageNumber }
  1975.     named @Columns { @Columns }
  1976.     {
  1977.         { Times Base 12p } @Font @InitialFont @Font
  1978.     { {@Hyph @Hyphenate} adjust 1.20fx } @Break @InitialBreak @Break
  1979.     {
  1980.         //  @FigureGalley {}
  1981.         //  @TableGalley  {}
  1982.         //  @SimplePageList
  1983.             @Columns { @Columns }
  1984.             @PageNumbers { @PageNumbers }
  1985.             @FirstPageNumber
  1986.     }
  1987.     }
  1988.  
  1989.     macro @Doc { @Document // }
  1990.  
  1991.  
  1992.     ###########################################################################
  1993.     #                                                                         #
  1994.     #  Report.                                                                #
  1995.     #                                                                         #
  1996.     ###########################################################################
  1997.  
  1998.     def @Report
  1999.     named @Title {}
  2000.     named @Author {}
  2001.     named @Institution {}
  2002.     named @DateLine { @Date }
  2003.     named @InitialFont { @InitialFont }
  2004.     named @InitialBreak { @InitialBreak }
  2005.     named @Hyphenate { @Hyphenate }
  2006.     named @PageNumbers { @PageNumbers }
  2007.     named @Columns { @Columns }
  2008.     {
  2009.     def @TitleMaterial
  2010.     {
  2011.             |0.5rt @B {{clines 1.4vx} @Break @Title} |
  2012.         //0.25i |0.5rt @I {clines @Break @Author} |
  2013.         //0.25i |0.5rt clines @Break @Institution |
  2014.     }
  2015.  
  2016.     def @ReportContent force into { @ColPlace&&following }
  2017.     {
  2018.                     @SectionList 1
  2019.         //@AppendixGap  @AppendixList 1
  2020.         //@SectionGap   @ReferenceSection
  2021.     }
  2022.  
  2023.     { Times Base 12p } @Font @InitialFont @Font
  2024.     { {@Hyph @Hyphenate} adjust 1.20fx } @Break @InitialBreak @Break
  2025.     {
  2026.         # cover sheet
  2027.             //  @PageMarker 0
  2028.         //  @Page {
  2029.             //1i      @TitleMaterial
  2030.             //0.5i      |0.5rt @OneCol { |0.5i @AbstractPlace |0.5i }
  2031.             //1i      @DateLine
  2032.             //1rt      @OneRow { //@MidGap @FootSect }
  2033.         }
  2034.  
  2035.         //  @FigureGalley {}
  2036.         //  @TableGalley  {}
  2037.         //  @ReportContent
  2038.  
  2039.         # first page
  2040.             //  @PageMarker 1
  2041.         //  @Page
  2042.         {
  2043.           @PageNumbers @Case
  2044.           {
  2045.             {Yes yes} @Yield @PageOneTopFormat num
  2046.             else      @Yield @Null
  2047.           }
  2048.           //
  2049.           //0.5i    @TitleMaterial
  2050.           //@MidGap    @ColList @Columns
  2051.           //1rt @OneRow
  2052.           {
  2053.                 //@MidGap
  2054.                 @PageNumbers @Case
  2055.                 {
  2056.                     {Yes yes} @Yield @PageOneFootFormat num
  2057.                     else      @Yield @Null
  2058.                 }
  2059.           }
  2060.         }
  2061.  
  2062.         # subsequent pages
  2063.         //    @SimplePageList
  2064.           @Columns { @Columns }
  2065.           @PageNumbers { @PageNumbers }
  2066.           2
  2067.     }
  2068.     }
  2069.  
  2070.  
  2071.     ###########################################################################
  2072.     #                                                                         #
  2073.     #  Book.                                                                  #
  2074.     #                                                                         #
  2075.     ###########################################################################
  2076.  
  2077.     def @Book
  2078.     named @Title {}
  2079.     named @Author {}
  2080.     named @Edition {}
  2081.     named @Publisher {}
  2082.     named @InitialFont { @InitialFont }
  2083.     named @InitialBreak { @InitialBreak }
  2084.     named @Hyphenate { @Hyphenate }
  2085.     {
  2086.     def @BookIntro force into { @IntroColPlace&&preceding }
  2087.     {
  2088.       @BookCoverFont @Font
  2089.       { //1i    |0.5rt 2.5f @Font {1.2fx clines} @Break @Title |
  2090.         //2i    |0.5rt clines @Break @Author |
  2091.         //1i    |0.5rt clines @Break @Edition |
  2092.         //1rt   @OneRow @Publisher
  2093.       }
  2094.         //        @Runner
  2095.         //1.1b  @PrefacePlace
  2096.         //1.1b  @ContentsSection
  2097.     }
  2098.  
  2099.     def @BookBody force into { @ColPlace&&preceding }
  2100.     {
  2101.             @IntroductionPlace
  2102.         //@ChapterGap   @ChapterList 1
  2103.         //@AppendixGap  @AppendixList 1
  2104.         //1.1b  @ReferenceSection
  2105.             headstyle { ragged @Break @BookTitleFormat @Title }
  2106.         //1.1b  @IndexSection
  2107.             headstyle { ragged @Break @BookTitleFormat @Title }
  2108.     }
  2109.  
  2110.     { Times Base 12p } @Font @InitialFont @Font
  2111.     { {@Hyph @Hyphenate} adjust 1.20fx } @Break @InitialBreak @Break
  2112.     {
  2113.             @IntroOddPageList @Columns { Single } 1
  2114.         //        @Runner
  2115.                 @FootEven { @PageNum }
  2116.                 @FootOdd  { |1rt @PageNum }
  2117.         //        @OddPageList @Columns { Single } 1
  2118.         //        @BookIntro
  2119.         //        @BookBody
  2120.         //        @Runner
  2121.     }
  2122.     }
  2123.  
  2124. @End @DocumentLayout
  2125.